import { reqGetSearchList } from "@/api/search";
const state = {
  searchList: {},
};
const mutations = {
  //获取搜索页面的数据
  GET_SEARCH_LIST(state, searchList) {
    state.searchList = searchList;
  },
};
const actions = {
  //获取搜索页面的数据
  async getSearchList({ commit }, params = {}) {
    let res = await reqGetSearchList(params);
    // console.log(res);
    if (res.code === 200) {
      commit("GET_SEARCH_LIST", res.data);
    }
  },
};
//计算属性 state代表当前search仓库
const getters = {
  goodsList(state) {
    return state.searchList.goodsList || [];
  },
  trademarkList(state) {
    return state.searchList.trademarkList || [];
  },
  attrsList(state) {
    return state.searchList.attrsList || [];
  },
};
export default {
  state,
  mutations,
  actions,
  getters,
};
